<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>用户注册</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	
    <!-- bootstrap -->
    <link href="${ctx }/static/css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="${ctx }/static/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="${ctx }/static/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="${ctx }/static/css/layout.css" />
    <link rel="stylesheet" type="text/css" href="${ctx }/static/css/elements.css" />
    <link rel="stylesheet" type="text/css" href="${ctx }/static/css/icons.css" />

    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="${ctx }/static/css/lib/font-awesome.css" />
    
    <!-- this page specific styles -->
    <link rel="stylesheet" href="${ctx }/static/css/compiled/signup.css" type="text/css" media="screen" />
    <!--[if lt IE 9]>
      <script src="${ctx }/static/js/html5shiv.min.js"></script>
    <![endif]-->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
	<form id="inputForm" action="${ctx}/register" method="post" >
		<div class="header">
        <a href="index.html">
            <img src="${ctx }/static/images/logo.png" class="logo" />
        </a>
    </div>
    <div class="row-fluid login-wrapper">
        <div class="box">
            <div class="content-wrap">
                <h6>注册用户</h6>
                <input class="span12" type="text" name="loginName" placeholder="用户名" />
                <input class="span12" type="password" name="password" placeholder="密码" />
                <input class="span12" type="password" placeholder="密码确认" />
                <div class="action">
                    <input type="submit" class="btn-glow primary signup" value="注册"/>
                </div>                
            </div>
        </div>

        <div class="span4 already">
            <p>已经有账号?</p>
            <a href="$[ctx]/login">去登录</a>
        </div>
    </div>

	</form>
	<!-- scripts -->
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="${ctx }/static/js/jquery.validate.min.js"></script>
    <script src="${ctx }/static/js/localization/messages_zh.min.js"></script>
    <script src="${ctx }/static/js/bootstrap.min.js"></script>
    <script src="${ctx }/static/js/theme.js"></script>
	<script>
		$(function() {
			//聚焦第一个输入框
			$("#loginName").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: {
					loginName: {
						remote: "${ctx}/register/checkLoginName"
					},
					password:{
						required:true
					}
				},
				messages: {
					loginName: {
						remote: "用户登录名已存在"
					}
				}
			});
		});
	</script>
</body>
</html>
